package com.example.teamwork1.controller;

import com.example.teamwork1.util.JWTUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class MainController {

    @RequestMapping("/login")
    public String login(){return "login";}

    @RequestMapping("/index")
    public String index(@RequestParam String token){
        if(token==null)
        {
            System.out.println("token为空");
            return "login";
        }else {
                if(!JWTUtil.verify(token))
                {
                    System.out.println("token有误");
                    return "login";
                }

            }
        return "index";
    }

    @RequestMapping("/register")
    public String registerCheck(){return "register";}

    @RequestMapping("/seekPassword")
    public String seekPasswordCheck(){return "seekPassword";}

    @RequestMapping("/mainPage")
    public String mainPageCheck(){return "mainPage";}

    @RequestMapping("/emailLogin")
    public String emailLogin(){return "emailLogin";}

}
